/**
 * Created by Zhang JiRen
 * @date 2022/7/6 0006
 */
//api/v1/user/login
import request from "@/utils/request";
const login = data => {
  return request({
    url: "/api/v1/user/login",
    method: "post",
    data: data
  });
};
const logout = data => {
  return request({
    url: "/api/v1/user/logout",
    method: "get",
    data: data
  });
};
const create = data => {
  return request({
    url: "/api/v1/user/create",
    method: "post",
    data: data
  });
};
const disable = data => {
  return request({
    url: "/api/v1/user/disable",
    method: "get",
    data: data
  });
};
const undisable = data => {
  return request({
    url: "/api/v1/user/undisable",
    method: "get",
    data: data
  });
};
const otp_disable = data => {
  return request({
    url: "/api/v1/user/otp/disable",
    method: "get",
    data: data
  });
};
const otp_enable = data => {
  return request({
    url: "/api/v1/user/otp/enable",
    method: "get",
    data: data
  });
};
const _delete = data => {
  return request({
    url: "/api/v1/user/delete",
    method: "get",
    data: data
  });
};
const chpasswd = data => {
  return request({
    url: "/api/v1/user/chpasswd",
    method: "post",
    data: data
  });
};
const setsuper = data => {
  return request({
    url: "/api/v1/user/setsuper",
    method: "get",
    data: data
  });
};
const unsetsuper = data => {
  return request({
    url: "/api/v1/user/unsetsuper",
    method: "get",
    data: data
  });
};
const setorg = data => {
  return request({
    url: "/api/v1/user/setorg",
    method: "get",
    data: data
  });
};
const unsetorg = data => {
  return request({
    url: "/api/v1/user/unsetorg",
    method: "get",
    data: data
  });
};
const info = () => {
  return request({
    url: "/api/v1/user/info",
    method: "get",
    hidetoast: true
  });
};
const setname = data => {
  return request({
    url: "/api/v1/user/setname",
    method: "post",
    data: data
  });
};
const users = data => {
  return request({
    url: "/api/v1/org/users",
    method: "get",
    data: data
  });
};
const scenario = data => {
  return request({
    url: "/api/v1/rule/scenario",
    method: "get",
    data: data
  });
};

const sessions = params => {
  return request({
    url: "/api/v1/user/sessions",
    method: "get",
    data: params
  });
};
const logout_force = data => {
  return request({
    url: "/api/v1/user/logout/force",
    method: "get",
    data: data
  });
};
const openrepswitch = data => {
  return request({
    url: "/api/v1/user/smart_report/enable",
    method: "get",
    data: data
  });
};
const closerepswitch = data => {
  return request({
    url: "/api/v1/user/smart_report/disable",
    method: "get",
    data: data
  });
};
const getrepswitch = data => {
  return request({
    url: "/api/v1/user/smart_report/status",
    method: "get",
    data: data
  });
};

export default {
  login,
  logout,
  create,
  disable,
  undisable,
  _delete,
  chpasswd,
  setsuper,
  unsetsuper,
  setorg,
  unsetorg,
  info,
  setname,
  users,
  scenario,
  sessions,
  logout_force,
  openrepswitch,
  closerepswitch,
  getrepswitch,
  otp_disable,
  otp_enable
};
